home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Database Designers / Rational Rose 2000 / Rational Setup.EXE / common / lib / Win32 / Sound.pm < prev    next >
Encoding:
Perl POD Document  |  1998-11-15  |  2.0 KB  |  76 lines

  1. package Win32::Sound;
  2. #######################################################################
  3. #
  4. # Win32::Sound - Perl Module for Windows Sound Interaction
  5. # ^^^^^^^^^^^^^^^^
  6. # Version: 0.03 (08 Apr 1997)
  7. #
  8. #######################################################################
  9.  
  10. require Exporter;       # to export the constants to the main:: space
  11. require DynaLoader;     # to dynuhlode the module.
  12.  
  13. @ISA= qw( Exporter DynaLoader );
  14. @EXPORT = qw(
  15.     SND_ASYNC
  16.     SND_NODEFAULT
  17.     SND_LOOP
  18.     SND_NOSTOP
  19. );
  20.  
  21. #######################################################################
  22. # This AUTOLOAD is used to 'autoload' constants from the constant()
  23. # XS function.  If a constant is not found then control is passed
  24. # to the AUTOLOAD in AutoLoader.
  25. #
  26.  
  27. sub AUTOLOAD {
  28.     my($constname);
  29.     ($constname = $AUTOLOAD) =~ s/.*:://;
  30.     #reset $! to zero to reset any current errors.
  31.     $!=0;
  32.     my $val = constant($constname, @_ ? $_[0] : 0);
  33.     if ($! != 0) {
  34.  
  35.     # [dada] This results in an ugly Autoloader error
  36.  
  37.     #if ($! =~ /Invalid/) {
  38.     #    $AutoLoader::AUTOLOAD = $AUTOLOAD;
  39.     #    goto &AutoLoader::AUTOLOAD;
  40.     #} else {
  41.     
  42.     # [dada] ... I prefer this one :)
  43.  
  44.         ($pack, $file, $line) = caller;
  45.         undef $pack; # [dada] and get rid of "used only once" warning...
  46.         die "Win32::Sound::$constname is not defined, used at $file line $line.";
  47.  
  48.     #}
  49.     }
  50.     eval "sub $AUTOLOAD { $val }";
  51.     goto &$AUTOLOAD;
  52. }
  53.  
  54.  
  55. #######################################################################
  56. # STATIC OBJECT PROPERTIES
  57. #
  58. $VERSION="0.03"; 
  59. undef unless $VERSION; # [dada] to avoid "possible typo" warning
  60.  
  61.  
  62. #######################################################################
  63. # dynamically load in the Sound.pll module.
  64. #
  65.  
  66. bootstrap Win32::Sound;
  67.  
  68. # Preloaded methods go here.
  69.  
  70. #Currently Autoloading is not implemented in Perl for win32
  71. # Autoload methods go after __END__, and are processed by the autosplit program.
  72.  
  73. 1;
  74. __END__
  75.  
  76.